package com.java.cloud.storage.service.impl;

import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.java.common.utils.PageUtils;
import com.java.common.utils.Query;

import com.java.cloud.storage.dao.StorageDao;
import com.java.cloud.storage.entity.Storage;
import com.java.cloud.storage.service.StorageService;

@Service("storageService")
public class StorageServiceImpl extends ServiceImpl<StorageDao, Storage> implements StorageService {

	@Override
	public PageUtils queryPage(Map<String, Object> params) {
		IPage<Storage> page = this.page(
				new Query<Storage>().getPage(params),
				new QueryWrapper<>()
		);

		return new PageUtils(page);
	}

	@Override
	public int decrease(Long productId, Integer count) {
		return this.baseMapper.decrease(productId, count);
	}

}